<template>
	<view class="message">
		<view class="message_top">
			<view class="message_top_title" :style="{top:computedTop}">消息</view>
		</view>

		<button @click="openConversationList">打开会话列表</button>
		<button @click="openContact">打开联系人</button>
		<!-- <button @click="openChat">OpenChat</button> -->



	<!-- 	<view class="message_body">
			<view class="message_body_inp">
				<u--input placeholder="请输入关键词" prefixIcon="search" prefixIconStyle="font-size: 14px;color: #999999"
					shape="circle" border="none" @confirm='confirm' v-model="input"></u--input>
				<view class="message_body_btn">搜索</view>
			</view>
		</view>

		<view class="message_listone" @click="LinkXt">
			<view>
				<view class="message_listone_icon flex">
					<image src="../../static/xt.png" class="bfbimages"></image>
				</view>
				<view>
					<text>系统通知</text><br />
					<text style="color: #ACABB0;font-size: 24rpx;">关于系统升级的通知</text>
				</view>
			</view>
			<view class="flex">
				<image src="../../static/right.png" class="bfbimages"></image>
			</view>
		</view>

		<view class="message_listone" @click="openChat">
			<view>
				<view class="message_listone_icon flex">
					<image src="../../static/logo.png" class="bfbimages"></image>
				</view>
				<view style="width:540rpx;height: 100%;">
					<view class="ellipsis message_listone_title">本部烧烤</view>
					<view class="ellipsis message_listone_text">你好我们的券还有吗</view>
				</view>
			</view>
			<view class="flex num" style="width: 32rpx;height: 32rpx;">1</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuButtonInfo: null,
				input: '',
				userID: 'cs-user2',
				groupID: ''
			}
		},
		computed: {
			computedTop() {
				if (this.menuButtonInfo) {
					return `${this.menuButtonInfo.height * 2 - 6}px`;
				}
				return '0px';
			},
		},
		onLoad() {
			const info = uni.getMenuButtonBoundingClientRect();
			this.menuButtonInfo = info;
		},
		onShow() {
			// this.ListApi()
		},
		methods: {
			// ListApi(){
			// 	console.log('执行')
			// 	// 获取全量的会话列表
			// 	let promise = chat.getConversationList();
			// 	promise.then(function(imResponse) {
			// 	  const conversationList = imResponse.data.conversationList; // 全量的会话列表，用该列表覆盖原有的会话列表
			// 	  const isSyncCompleted = imResponse.data.isSyncCompleted; // 从云端同步会话列表是否完成
			// 	}).catch(function(imError) {
			// 	  console.warn('getConversationList error:', imError); // 获取会话列表失败的相关信息
			// 	});
			// },
			openChat() {
				// 1v1 chat: conversationID = `C2C${userID}`
				// group chat: conversationID = `GROUP${groupID}`
				const conversationID = 'C2C' + this.userID;
				uni.navigateTo({
					url: `/TUIKit/components/TUIChat/index?conversationID=${conversationID}`
				});
			},
			// 打开会话列表
			openConversationList() {
				uni.navigateTo({
					url: '/TUIKit/components/TUIConversation/index'
				});
			},
			// 打开联系人
			openContact() {
				uni.navigateTo({
					url: '/TUIKit/components/TUIContact/index'
				});
			},
			linkchat() {
				uni.navigateTo({
					url: '/pages/chat/chat'
				})
			},
			confirm() {
				console.log(this.input);
			},
			LinkXt() {
				uni.navigateTo({
					url: '/pages/system/system'
				})
			}
		}
	}
</script>

<style lang="scss">
	.message {
		width: 100vw;
		min-height: 100vh;
		float: left;
		background-color: #FFFFFF;

		.message_top {
			width: 100%;
			height: 200rpx;
			position: relative;

			.message_top_title {
				width: auto;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 36rpx;
				color: #333333;
				position: absolute;
				left: 30rpx;
			}
		}

		.message_body {
			width: 100%;
			height: 100rpx;
			background: #F7F7F7;
			border-radius: 50rpx;
			display: flex;
			align-items: center;
			justify-content: center;

			.message_body_inp {
				width: 670rpx;
				height: 80rpx;
				background: #F7F7F7;
				border-radius: 50rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-left: 10rpx;
				padding-right: 10rpx;
			}

			.message_body_btn {
				width: 116rpx;
				height: 64rpx;
				background: linear-gradient(270deg, #FE4624 0%, #FF8143 100%);
				border-radius: 40rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #FFFFFF;
				text-align: center;
				line-height: 64rpx;
			}
		}

		.message_listone {
			width: 710rpx;
			height: 110rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin: 30rpx auto 0;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #11182F;
		}

		.message_listone>view:nth-child(1) {
			width: 90%;
			height: 100%;
			display: flex;
			align-items: center;
		}

		.message_listone>view:nth-child(2) {
			width: 18rpx;
			height: 27rpx;
		}

		.message_listone_icon {
			width: 98rpx;
			height: 98rpx;
			border-radius: 50%;
			overflow: hidden;
			margin-right: 20rpx;
		}

		.message_listone_title,
		.message_listone_text {
			width: 100%;
			height: 50%;
			display: flex;
			align-items: center;
		}

		.message_listone_text {
			font-weight: 500;
			font-size: 24rpx;
			color: #ACABB0;
		}
	}

	.num {
		width: 32rpx;
		height: 32rpx;
		background: #FF5454;
		border-radius: 50%;
		text-align: center;
		line-height: 32rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 20rpx;
		color: #FFFFFF;
	}
</style>